# Maintainer: Jan de Groot <jgc@archlinux.org>

pkgname=upower
pkgver=0.99.8
pkgrel=2
pkgdesc="Abstraction for enumerating power devices, listening to device events and querying history and statistics"
url="https://upower.freedesktop.org"
arch=(x86_64)
license=(GPL)
depends=(systemd libusb libimobiledevice libgudev)
makedepends=(intltool docbook-xsl gobject-introspection python2 git gtk-doc)
backup=(etc/UPower/UPower.conf)
_commit=6d8eb754644922a2a3d5a074ce51a1d25a2cd1ee  # tags/UPOWER_0_99_8^0
source=("git+https://anongit.freedesktop.org/git/upower#commit=$_commit")
md5sums=('SKIP')

pkgver() {
  cd $pkgname
  git describe --tags | sed -e 's/UPOWER_//' -e 's/_/\./g' -e 's/-/+/g'
}

prepare() {
  cd $pkgname
  git cherry-pick -n 99b2e1a751e6208a7be61b50652973df5a9f1d83
  git cherry-pick -n 453ec99c5c34a304f15ac9d4b6e50f5bf281fee3
  NOCONFIGURE=1 ./autogen.sh
}

build() {
  cd $pkgname
  ./configure \
    --prefix=/usr \
    --sysconfdir=/etc \
    --localstatedir=/var \
    --libexecdir=/usr/lib \
    --disable-static
  make
}

package() {
  cd $pkgname
  make DESTDIR="$pkgdir" install
}
